package com.rising.threads.subThread;

/**
 * @Author: rising
 * @Description:
 * @Date: create in 2021/3/2 22:47
 */
public class SubThread {

    public static void main(String[] args) {
        Thread threadaA = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程名称：" + Thread.currentThread().getName());
                Thread threadB = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            Thread.sleep(2 * 1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        System.out.println("线程名称：" + Thread.currentThread().getName());
                    }
                },"线程B");
                threadB.start();
            }
        },"线程A");
        threadaA.start();
    }

}
